/******************************************************************************
COPYRIGHT (C) 2013 by IT-Designers GmbH

File:		RoadLane.h
Created:	07.03.2013
Modified:	07.03.2013
Author:		Max Pejs
******************************************************************************/

#ifndef ROADLANE_H
#define ROADLANE_H

#include "opencv2/highgui/highgui.hpp"
#include "opencv2/imgproc/imgproc.hpp"
#include "opencv2/features2d/features2d.hpp"
#include "opencv2/nonfree/features2d.hpp"
#include "opencv2/core/core.hpp"

#include "Geometry/Line2D.h"
#include "Utility/Measure.h"
#include "defines.h"

#include <iostream>

using namespace cv;
using namespace std;

enum LaneType
{
	LEFT_LANE,
	RIGHT_LANE
};

class RoadLane
{
private:
	Line2D centerLine;
	LaneType LaneTp;

	vector<Line2D> LinePartsVector;
	vector<Point2d> BasePoints;

public:
	RoadLane();
	RoadLane(LaneType lp);
	~RoadLane();

	void Find(Mat & binaryImg);

	Line2D GetSingleLinePart(unsigned int ind);
	
	vector<Point2d> & GetBasePoints();

	void Match(Mat & src, Mat & templ);

	void lines2Cluster(vector<Vec4i> & lines);

	unsigned LinePartsCnt();

	void PlotParameters(Mat & img, CvScalar & color, Point & offset = Point(0,0));

	Line2D GetCenterLine();

	void Move(Point2d & offset);
	void Transform(Mat & H);
	int DetermineLaneType(Mat & img);
	void PlotBasePoints(Mat & img, CvScalar & color);
	void PlotLineParts(Mat & img, CvScalar & color,	bool plotCenterLine = false);
};

#endif	// ROADLANE_H